
package tereshchuk.homework;

/**
 *
 * @author Pasha
 */

import java.io.*;
import java.util.*;


public class BoxDrawingCharacters {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		mCharacterGraphics characterGraphics = new mCharacterGraphics();
                mMathOpperation mathOpperation = new mMathOpperation();
                int Count;
		do {
			System.out.print("Введите количество выводимых *:");
			if (sc.hasNextInt()) {
                                Count = sc.nextInt();
				break;
			} else {
				System.out.println("Введено не числовое значение.");
				sc.next();
			}
		} while(true);
		
                characterGraphics.printCharacterGraphics(Count);
                System.out.println();
                mathOpperation.printCharacterGraphics(Count);
                System.out.println();
		System.out.println("The End!");
    }
    
}

class mCharacterGraphics {

	public void printCharacterGraphics(int Count) {
		System.out.println("\tПсевдографика 1");
		print1(Count);
		System.out.println("\tПсевдографика 2");
		print2(Count);
		System.out.println("\tПсевдографика 3");
		print3(Count);
	}

	public void print1(int Count) {
		for (int i = 1; i <= Count; i++ ) {
			for (int j = 1; j <=i; j++) {
				System.out.print("*");
			}
			System.out.println();
		}
	}
	
	public void print2(int Count) {
		for (int i = Count; i >= 1; i--){
			for (int j = i; j >= 1; j--) {
				System.out.print("*");
			}
			System.out.println();
		}
	}
	
	public void print3(int Count) {
                //int k = 0;
		for (int i = 1; i <= Count / 2; i++) {
                    for (int j = 1; j < i; j++){
                        System.out.print(" ");
                    }
                    for (int j = i - 1; j <= Count - i; j++) {
                            System.out.print("*");
                    }
                    System.out.println();
		}
                int k;
                for (int i = 1; i < Count / 2; i++) {
                    k = 0;
                    for (int j = Count / 2; j > (i + 1); j--){
                        System.out.print(" ");
                        k++;
                    }
                    for (int j = k; j < Count - k; j++) {
                        System.out.print("*");
                    }
                    System.out.println();
                }		
	}
	
}

class mMathOpperation {
    
    public void printCharacterGraphics(int Count) {
        System.out.println("\tФебоначи");
        print1(Count);
        System.out.println();
        System.out.println("\tЗолотое сечение");
        print2(Count);
    }
        
    public void print1(int Count) {
        int f1 = 0;
        int f2 = 1;
        for (int j = 0; j < Count + 2; j++) {
            System.out.print("" + f1 + " ");
            f1 = f1 +f2;
            f2 = f1 - f2;            
        }
    }

    public void print2(int Count) {
        double f1 = 1;
        double f2 = 2;
        for (int j = 0; j < Count + 2; j++) {
            System.out.print("" + Double.toString(f1 / f2) + " ");
            f1 = f1 +f2;
            f2 = f1 - f2;            
        }
    }
}